import request from '/@/utils/request';

export function deptApi() {
	return {
		createDept: (data: object) => {
			return request({
				url: '/sys/dept/create',
				method: 'POST',
				data,
			});
		},
		updateDept: (data: object) => {
			return request({
				url: '/sys/dept/update',
				method: 'PUT',
				data,
			});
		},
		changeParent: (data: object) => {
			return request({
				url: '/sys/dept/changeparentid',
				method: 'POST',
				data,
			});
		},
		deleteDept: (id: any) => {
			return request({
				url: `sys/dept/delete/${id}`,
				method: 'DELETE',
			});
		},
		viewDept: (id: any) => {
			return request({
				url: `sys/dept/view/${id}`,
				method: 'GET',
			});
		},
		tree: () => {
			return request({
				url: `sys/dept/tree`,
				method: 'GET',
			});
		},
	};
}
